#ifndef UI_H_
#define UI_H_

#include "common.h"

#define SIZEOF_ARRAY(array) (sizeof(array) / sizeof(*array))

// UI video element (smk player)
struct s_ui_video
{
	// SMK file name
	const char *fname;

	// x/y position and w/h for frame placement on screen
	unsigned short x, y;
};

// UI static element (texture)
struct s_ui_static
{
	// screen position
	unsigned short x, y, w, h;
	// texture coords (not highlighted)
	unsigned short t_x, t_y, t_w, t_h;
	// texture coords (when highlighted)
	unsigned short hi_x, hi_y, hi_w, hi_h;

	// highlight region: switch to hilight when cursor is in this box
	unsigned short reg_x, reg_y, reg_w, reg_h;

	// texture ID number
	GLuint tex;

	// gamestate to switch to when element clicked (or 0 for no change)
	int gamestate_click;

	// flags: play sound when X occurs?
	unsigned char mouseover_sound;
	unsigned char mouseup_sound;
};

struct s_ui_text
{
	int x, y;
	const char *text;
};

// Screen definition
struct s_ui_screen
{
	float w, h;

	unsigned char vid_priority;

	int gamestate_escape;

	unsigned char num_tex, num_vid, num_obj, num_txt;

	const char *name_bgm;
	const char **tex_fname;

	const struct s_ui_video *vid;
	const struct s_ui_static *obj;
	const struct s_ui_text *txt;
};

// Prototype
int ui_main(struct s_ui_screen);

#endif
